package model

var CtxUserIDKey = "UserID"

// 玩家账号状态枚举
const (
	UserStateCommon    int8 = 0 //玩家账号状态正常
	UserStateForbidden int8 = 1 //被封禁
)

type User struct {
	UserID   int64  `json:"user_id" db:"user_id"`
	UserName string `json:"username" db:"username"`
	PassWord string `json:"password" db:"password"`
	Status   int8   `json:"status" db:"status"`
}

type UserLoginData struct {
	UserName string `form:"username" json:"username" binding:"required"`
	PassWord string `form:"password" json:"password" binding:"required"`
}

// token和userID 存储在redis中的结构体
type UserTokenData struct {
	Token     string `json:"token"`
	UserID    int64  `json:"user_id"`
	Forbidden bool   `json:"forbidden"`
	IsAdmin   bool   `json:"is_admin"`
}

type UserPasswordRData struct {
	UserName   string `json:"username"`
	Password   string `json:"password"`
	EnPassword string `json:"enpassword"`
}

/*
		`user_id` bigint(20) NOT NULL,
	    `role_name` bigint(20) NOT NULL DEFAULT '' COMMENT '用户昵称',
	    `real_name` varchar(64) NOT NULL DEFAULT '' COMMENT '用户真实名字',
	    `A` bigint(20) NOT NULL DEFAULT 0 COMMENT '玩家金币',
*/
type UserInfo struct {
	UserID   int64  `json:"user_id" db:"user_id"`
	RoleName string `json:"role_name" db:"role_name"`
	RealName string `json:"real_name" db:"real_name"`
	Avatar   string `json:"avatar" db:"avatar"`
	Power    int32  `json:"power" db:"power"`
}

type UserInfoShow struct {
	UserID   int64    `json:"user_id"`
	RoleName string   `json:"role_name"`
	Avatar   string   `json:"avatar"`
	Power    int32    `json:"power"`
	IsBid    bool     `json:"is_bid"`
	Roles    []string `json:"roles"`
}

// 用户注册请求数据
type UserRegistReqData struct {
	UserName   string `form:"username" json:"username" binding:"required"`
	Password   string `form:"password" json:"password" binding:"required"`
	Repassword string `form:"repassword" json:"repassword" binding:"required"`
	Avatar     string `form:"avatar" json:"avatar"`
}
